//
//  CommunityMainModel.m
//  ArtDog
//
//  Created by dllo on 16/9/3.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "CommunityMainModel.h"
#import "CommunityAdvList.h"
#import "CommunityListUsers.h"
#import "CommunityTopicList.h"

@implementation CommunityMainModel

- (void)setValue:(id)value forKey:(NSString *)key
{
    [super setValue:value forKey:key];
    if ([key isEqualToString:@"advList"]) {
        NSMutableArray<CommunityAdvList *> *array = [NSMutableArray array];
        for (NSDictionary *dic in value) {
            CommunityAdvList *advList = [CommunityAdvList modelWithDic:dic];
            [array addObject:advList];
        }
        _advList = array;
    } else if ([key isEqualToString:@"listUsers"]) {
        NSMutableArray<CommunityListUsers *> *array = [NSMutableArray array];
        for (NSDictionary *dic in value) {
            CommunityListUsers *listUsers = [CommunityListUsers modelWithDic:dic];
            [array addObject:listUsers];
        }
        _listUsers = array;
        
    } else if ([key isEqualToString:@"hotTopicList"] || [key isEqualToString:@"topicList"] ) {
        NSMutableArray<CommunityTopicList *> *array = [NSMutableArray array];
        for (NSDictionary *dic in value) {
            CommunityTopicList *topicListModel = [CommunityTopicList modelWithDic:dic];
            [array addObject:topicListModel];
        }
        if ([key isEqualToString:@"hotTopicList"]) {
            _hotTopicList = array;
        } else {
            _topicList = array;
        }
        
    }
}


@end
